package com.wuheng.smartlock;

import android.content.Context;
import android.content.SharedPreferences;

public class Prefs {
	static SharedPreferences myPrefs;

	public static boolean isEnable(Context ctx) {
		if (myPrefs == null)
			myPrefs = ctx
					.getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
		return myPrefs.getBoolean("enable", false);

	}

	public static void setEnable(Context ctx, boolean en) {
		if (myPrefs == null)
			myPrefs = ctx
					.getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
		myPrefs.edit().putBoolean("enable", en).commit();
	}

	public static boolean isProximityEnable(Context ctx) {
		if (myPrefs == null)
			myPrefs = ctx
					.getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
		return myPrefs.getBoolean("proximity_enable", false);

	}

	public static void setProximityEnable(Context ctx, boolean en) {
		if (myPrefs == null)
			myPrefs = ctx
					.getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
		myPrefs.edit().putBoolean("proximity_enable", en).commit();
	}

	public static void setUnlockEnable(Context ctx, boolean en) {
		if (myPrefs == null)
			myPrefs = ctx
					.getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
		myPrefs.edit().putBoolean("unlock_enable", en).commit();
	}

	public static boolean isUnlockEnable(Context ctx) {
		if (myPrefs == null)
			myPrefs = ctx
					.getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
		return myPrefs.getBoolean("unlock_enable", false);

	}

	public static void setWakeEnable(Context ctx, boolean en) {
		if (myPrefs == null)
			myPrefs = ctx
					.getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
		myPrefs.edit().putBoolean("wake_enable", en).commit();
	}

	public static boolean isWakeEnable(Context ctx) {
		if (myPrefs == null)
			myPrefs = ctx
					.getSharedPreferences("my_prefs", Context.MODE_PRIVATE);
		return myPrefs.getBoolean("wake_enable", false);

	}
}
